<%--
  Created by IntelliJ IDEA.
  User: 刘邓
  Date: 2023-06-10
  Time: 16:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加我的名片</title>
</head>
<body>
<%--
  Created by IntelliJ IDEA.
  User: 刘邓
  Date: 2023-06-10
  Time: 9:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加名片</title>
</head>
<body>
<form action="/card/add" class="container">
    <div>姓名:<input type="text" name="name" id="r_name"></div>
    <div> 性别:<input type="radio" name="sex" value="0" checked>男 &nbsp<input type="radio" name="sex" value="1">女</div>
    <div>邮箱:<input type="text" name="email" id="r_email"></div>
    <div>用户:<input type="text" name="userId" id="r_userId"></div>
    <div style="padding-left: 30px"><input type="submit" value="添加" id="toAdd"></div>
</form>
<script>
    let toAdd = document.getElementById("toAdd");
    toAdd.addEventListener("click",(evt)=>{
        let name_str=document.getElementById("r_name").value;
        if(name_str===null||name_str===""){
            alert("请输入姓名");
            evt.preventDefault();
            return;
        }
        let email_str=document.getElementById("r_email").value;
        if(email_str===null||email_str===""){
            alert("请输入邮箱");
            evt.preventDefault();
            return;
        }
        let userId_str=document.getElementById("r_userId").value;
        if(userId_str===null||userId_str===""){
            alert("请输入用户ID");
            evt.preventDefault();
            return;
        }
    })
</script>

</body>
</html>
